package com.knightboy.smartshoes.myUi;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import com.knightboy.smartshoes.R;
import com.knightboy.smartshoes.coreUtil.SenserData;

/**
 * Created by knightBoy on 2015/8/4.
 */
public class TestActivity extends Activity {
    TextView jiasudu_tv, jiaosudu_tv;
    EditText jiasudu_et, jiaosudu_et;
    Button jiasudu_bt, jiaosudu_bt;

    private int acceleration;
    private int palastance;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.test);
        init();
    }

    private void init(){
        jiaosudu_tv = (TextView)findViewById(R.id.jiaosudu);
        jiasudu_tv = (TextView)findViewById(R.id.jiasudu);
        jiasudu_et = (EditText)findViewById(R.id.jiasudu_et);
        jiaosudu_et = (EditText)findViewById(R.id.jiaosudu_et);
        jiasudu_bt = (Button)findViewById(R.id.jiasudu_bt);
        jiaosudu_bt = (Button)findViewById(R.id.jiaosudu_bt);

        jiasudu_tv.setText(SenserData.getAcceleration()+"");
        jiaosudu_tv.setText(SenserData.getPalstance()+"");

        jiasudu_bt.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                acceleration = Integer.parseInt(jiasudu_et.getText().toString());
                SenserData.setAcceleration(acceleration);
                TestActivity.this.finish();
            }
        });

        jiaosudu_bt.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v) {
                palastance = Integer.parseInt(jiaosudu_et.getText().toString());
                SenserData.setPalstance(palastance);
                TestActivity.this.finish();
            }
        });
    }
}
